//
//  AFFData.m
//  AnyfishApp
//
//  Created by Bob Lee on 15/9/29.
//  Copyright © 2015年 Anyfish. All rights reserved.
//

#import "AFFData.h"

@implementation AFFData

- (BOOL)isEqual:(id)object {
    if(![object isKindOfClass:[self class]])
        return NO;
    
    return [super isEqual:object];
}

- (id)init {
    self = [super init];
    if(self){
        [self setDefaultValue];
    }
    
    return self;
}

- (void)setDefaultValue {
//    self.isCache = YES;
}




- (id)initWithData:(NSData*)aData {
    self = [self init];
    if(self){
        [self updateWithData:aData];
    }
    
    return self;
}

+ (id)initWithData:(NSData *)aData {
    return [[[self class] alloc] initWithData:aData];
}

- (void)updateWithData:(NSData *)aData {
    self.aData = aData;
}

- (id)copyWithZone:(NSZone *)zone {
   if(self.aData){
        return [[[self class] allocWithZone:zone] initWithData:self.aData];
    }else {
        return [[self class] allocWithZone:zone];
    }
}

- (id)copyMemoryAF {
    return [NSKeyedUnarchiver unarchiveObjectWithData:[NSKeyedArchiver archivedDataWithRootObject:self]];
}

@end
